<!DOCTYPE html>
<html th:replace="layout :: layout(~{::title}, ~{::style}, ~{::script}, ~{::#heading}, ~{::#content}, 'project-list')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>项目列表</title>
    <style>
        .table > tbody > tr > td {
            vertical-align: middle;
        }
    </style>
    <script>
        function del(id){
            delAlert(function(){
                $.ajax({
                    url: "[[@{{su}/project/ajax/delete(su=${staticUrl})}]]",
                    type: "post",
                    data: {
                        "id": id
                    },
                    dataType: "json",
                    success: function (re) {
                        if (re.status) {
                            location.reload()
                        }
                    },
                    error: function () {
                        msgAlert("操作失败")
                    }
                });
            });
        }
    </script>
</head>
<body>
<div id="heading" class="row wrapper border-bottom white-bg page-heading">
    <div class="col-lg-10">
        <h2>项目列表</h2>
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a>项目管理</a>
            </li>
            <li class="breadcrumb-item active">
                <strong>项目列表</strong>
            </li>
        </ol>
    </div>
    <div class="col-lg-2">

    </div>
</div>
<div id="content" class="wrapper wrapper-content animated fadeInRight">
    <div class="row" th:object="${page}">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-content">

                    <table class="table">
                        <thead>
                        <tr>
                            <th>项目名称</th>
                            <th>ArtifactId</th>
                            <th>Git</th>
                            <th>吉祥物</th>
                            <th>项目描述</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr th:each="d:*{list}" th:object="${d}">
                            <td th:text="*{name}">接口名称</td>
                            <td th:text="*{artifactId}">ArtifactId</td>
                            <td th:text="*{git}=='gitee'?'码云':'GitHub'">Git</td>
                            <td th:text="*{mascot}">吉祥物</td>
                            <td th:text="*{desc}">项目描述</td>
                            <td>
                                <a th:href="@{{su}/project/update/{id}(su=${staticUrl},id=*{id})}" class="btn btn-primary btn-xs">修改</a>
                                <button type="button" class="btn btn-danger btn-xs" th:onclick="|del(*{id})|">删除</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>

                    <div class="btn-group" th:if="*{pages}>1">
                        <button th:unless="${isFirstPage}" type="button" class="btn btn-white"><i
                                class="fa fa-chevron-left"></i></button>
                        <button type="button" class="btn btn-white" th:classappend="${pageNum}==${n}?'active'"
                                th:each="n:*{navigatepageNums}" th:text="${n}">1
                        </button>
                        <button th:unless="${isLastPage}" type="button" class="btn btn-white"><i
                                class="fa fa-chevron-right"></i></button>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
